package com.example.com.daervideo.popuwindow;

import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;

import com.example.com.daervideo.R;

/**
 * Created by i7-1 on 2018/12/11.
 */

public class PublishPpWindow extends PopupWindow {

    public PublishPpWindow(Context context, View.OnClickListener listener) {
        View inflate = LayoutInflater.from(context).inflate(R.layout.popuwindow_publish, null);
        inflate.findViewById(R.id.out_link).setOnClickListener(listener);
        inflate.findViewById(R.id.pulish_local).setOnClickListener(listener);
        inflate.findViewById(R.id.transcribe).setOnClickListener(listener);
        inflate.findViewById(R.id.out).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
        //设置SelectPicPopupWindow的View
        this.setContentView(inflate);
        //适配虚拟键
        this.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
        //设置SelectPicPopupWindow弹出窗体的宽
        this.setWidth(RelativeLayout.LayoutParams.MATCH_PARENT);
        //设置SelectPicPopupWindow弹出窗体的高
        this.setHeight(RelativeLayout.LayoutParams.MATCH_PARENT);
        //设置SelectPicPopupWindow弹出窗体可点击
        this.setFocusable(true);
        //实例化一个ColorDrawable颜色为半透明
        ColorDrawable dw = new ColorDrawable(0x30000000); //android:background="#30000000"
        //设置SelectPicPopupWindow弹出窗体的背景
        this.setBackgroundDrawable(dw);
    }
}
